﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<QLPKWeb.Models.FormBean.LichLamViecModel.LichLamViecForm>" %>

<%@ Import Namespace="QLPKWeb.Models.LinQ.LichLamViec" %>
<%@ Import Namespace="QLPKWeb.Models.FormBean.LichLamViecModel" %>
<%@ Import Namespace="Webdiyer.WebControls.Mvc" %>
<%@ Import Namespace="System.Web.Mvc.Html" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <script type="text/javascript" language="javascript" src="<%= ResolveUrl("~/Content/Scripts/LichLamViec/LichLamViec.js") %>"></script>
    <script type="text/javascript" language="javascript" src="<%= ResolveUrl("~/Content/Scripts/KiemTra.js") %>"></script>
    <script language="javascript" type="text/javascript">
        $(document).ready(function () {
            selectMenu("LichLamViec-DangKyLich");
            $("#LichLamViec-DangKyLich").parent().attr("class", "opened");
        });
        $(document).ready(function () {
            $("#ToDate").datepicker({ dateFormat: 'dd/mm/yy' });
            $("#FromDate").datepicker({ dateFormat: 'dd/mm/yy' });
        });
        
    </script>
 

    <form id="form" method="post" action="#">
        <input type="hidden" id="ID" name="ID" value="<%=Model.ID %>"/>
        <%=Html.Hidden("PageNumber", Model.PageNumber)%>
        <div class="box round first fullpage">
            <h4> Lịch làm việc</h4>
		 
            <table  class="data display datatable" width="100%">
                <tr>
                    <td colspan="2">
                        <%--Thông Báo--%>
                        <div id="MessageLichLamViec" style="font-size: 12px; color: Blue; font-weight: bold">
                            <%=Model.MessageCreateLichLamViec %>
                            <%=Model.MessageEditLichLamViec %>
                        </div>
                        <%--end--%>
                    </td>
                    <td colspan="2" align="right">
                    </td>
                </tr>
                <tr>
                    <td colspan="4" style="padding-top: 10px;">
                        <span style="display:inline;">Chọn ngày</span>
                        <% int dayofweek = (int)DateTime.Now.DayOfWeek; %>
                        <input name="FromDate" id="FromDate" 
                            value="<%= !string.IsNullOrEmpty(Model.FromDate) ?  Model.FromDate : DateTime.Now.ToString("dd/MM/yyyy") %>" 
                            style="display: inline;" />
                        <%--<input name="FromDate" id="Text1" 
                            value="<%= !string.IsNullOrEmpty(Model.FromDate) ?  Model.FromDate : DateTime.Now.AddDays(-dayofweek + 1).ToString("dd/MM/yyyy") %>" 
                            style="display: inline;" />--%>
                       <%-- <span style="display:inline; margin-left: 40px;">Đến ngày</span>--%>
                        <%--<input name="ToDate" id="ToDate" 
                            value="<%= !string.IsNullOrEmpty(Model.ToDate) ? Model.ToDate : DateTime.Now.AddDays(7 - dayofweek).ToString("dd/MM/yyyy") %>" 
                            style="display: inline;" />--%>
                        <input type="button" value="Xem" onclick="javascript:DoView()" style="display: inline;" />
                        <input type="button" value="Đăng ký lịch" onclick="javascript:DoDangKyLich()" style="display: inline;" />                        
                    </td>
                </tr>
                <tr>
                    <td colspan="4" style="padding-top: 10px;">
                        <table cellspacing="0" cellpadding="0" style="width: 100%">
                            <tr class="title">
                                <td style="border: 1px solid #ddd " class="first" nowrap="nowrap">
                                    <strong>
                                        Duyệt
                                    </strong>
                                </td>
                                <td style="border: 1px solid #ddd "nowrap="nowrap">
                                    <strong>
                                        Thời gian bắt đầu
                                    </strong>
                                </td>
                               
                                <td style="border: 1px solid #ddd "nowrap="nowrap">
                                    <strong>
                                        Thời gian kết thúc
                                    </strong>
                                </td>
                              <%--  <td nowrap="nowrap">
                                    <strong>
                                        Ngày làm việc
                                    </strong>
                                </td>--%>
                                <td style="border: 1px solid #ddd "nowrap="nowrap">
                                    <strong>
                                        Nội dung
                                    </strong>
                                </td>
                                <td style="border: 1px solid #ddd "class="last" nowrap="nowrap">
                                    <strong>
                                        
                                    </strong>
                                </td> 
                            </tr>
                        <% foreach (LichLamViec item in Model.LichLamViecPagedList)
                           {
                            %>
                            <tr class="item_row" onclick="javascript:highlight(this);">
                                <td style="border: 1px solid #ddd "class="first">
                                    <input type="checkbox" disabled="disabled" <% if(item.Status != null && item.Status.Value) { %> checked="checked" <% } %> />
                                </td>
                                 <td style="border: 1px solid #ddd "nowrap="nowrap">
                                    <%--<%= item.EventDate != null ? item.EventDate.Value.ToString("dd/MM/yyyy") : ""%>--%>
                                    <%= item.StartTime != null ? "Ngày " + item.StartTime.Value.ToString("dd/MM/yyyy") + " - Lúc : " + item.StartTime.Value.ToString("HH") + " giờ " + item.StartTime.Value.ToString("mm") + " phút " : ""%>
                                </td>
                                <td style="border: 1px solid #ddd "nowrap="nowrap">
                                    <%= item.EndTime != null ? "Ngày " + item.EndTime.Value.ToString("dd/MM/yyyy") + " - Lúc : " + item.EndTime.Value.ToString("HH") + " giờ " + item.StartTime.Value.ToString("mm") + " phút " : ""%>
                                </td>
                                <%--<td>
                                    <%= item.EndTime != null ? item.EndTime.Value.ToString("hh:mm:ss") : ""%>
                                </td>--%>
                                <%--<td>
                                    <%= item.EndDate != null ? item.EndDate.Value.ToString("dd/MM/yyyy") : ""%>
                                </td>--%>
                                <td style="border: 1px solid #ddd ">
                                    <%= DONGACS.Common.ConvertUtils.TruncateAtWord(item.NoiDung,30) %>
                                </td>
                                <td style="border: 1px solid #ddd "class="last" nowrap="nowrap">
                                    <a  style="color: blue"onclick="javascript:window.location.href = basePath + 'LichLamViec/SuaLichLamViec/<%= item.ID %>';">Xem chi tiết</a>
                                </td>
                            </tr>
                            <%
                           } %>
                            <tr class="border_bottom">
                                <td class="first" style="background: #DDDDDD">
                                </td>
                                <td class="last" colspan="8" align="right" style="background: #DDDDDD; padding-right: 10px">                                     
                                     <%
                                         PagerOptions pagerOptions = new PagerOptions();
                                         QLPKWeb.BussinessDelegate.CommonDelegate.CommonDelegate CommonDelegate
                                             = new QLPKWeb.BussinessDelegate.CommonDelegate.CommonDelegate();
                                         CommonDelegate.ChangeTextPaging(pagerOptions, string.Empty);
                                     %>
                                    <div><%=Html.Pager(Model.LichLamViecPagedList,pagerOptions) %></div>
                                    <%=Html.Hidden("PageNumber", Model.PageNumber)%>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
        </div>
    </form>

    <div style='width:250px; height:180px;display:none; z-index:100000;  position:absolute; border:5px solid #ddd; background:#fff; padding:4px' id="ViewNguoiChuanBi">
        <div style='width:100%; height:10px;'>
        <img src="<%=ResolveUrl("~/Content/ImagesAdmin/publish_x.png")%>" style='float:right; margin:3px; cursor:pointer;' title='close' 
            onclick='$("#ViewNguoiChuanBi").css("display", "none")'>
        </div>
        <div style='width:100%; height:90px; overflow:auto'>
            <div id="tbl_DanhSachNguoiChuanBi">
                <table>
                    <tbody>
                               
                    </tbody>
                </table>
            </div>
        </div>
        <div class="pagebreak"> &nbsp;</div>
        <div style="text-align:center"><input type="button" id="OK" name="OK" value="OK" class="button1" onclick='$("#ViewNguoiChuanBi").css("display", "none")'/></div>
    </div>

    <div style='width:250px; height:180px;display:none; z-index:100000;  position:absolute; border:5px solid #ddd; background:#fff; padding:4px' id="ViewThanhPhan">
        <div style='width:100%; height:10px;'>
        <img src="<%=ResolveUrl("~/Content/ImagesAdmin/publish_x.png")%>" style='float:right; margin:3px; cursor:pointer;' title='close' 
            onclick='$("#ViewPhongPhoiHop").css("display", "none")'>
        </div>
        <div style='width:100%; height:90px; overflow:auto'>
            <div id="tbl_DanhSachThanhPhan">
                <table>
                    <tbody>
                               
                    </tbody>
                </table>
            </div>
        </div>
        <div class="pagebreak"> &nbsp;</div>
        <div style="text-align:center"><input type="button" id="Button1" name="OK" value="OK" class="button1" onclick='$("#ViewThanhPhan").css("display", "none")'/></div>
    </div>
</asp:Content>
